<template>
    <view class="giantScreen" :style="{'padding-top':`${clientRect.top}px`}">
        <div class="bg background--custom"></div>
        <div class="head" :style="{height:`${clientRect.height}px`}">
            <div class="left" :style="{left:`${clientRect.right}px`}">
                <view class="back" @click="handleBack">
                    <image class="img" src="/static/img/view/back.png" mode="widthFix"></image>
                </view>
                <view class="center">|</view>
                <view class="homekaytix" @click="handleHome">
                    <image class="img" src="/static/img/view/homekaytix.svg" mode="widthFix"></image>
                </view>
            </div>
            <div class="title">تەڭگە يىغىش</div>
        </div>
        <div class="body">
            <div class="userinfo">
                <view class="avatar">
                    <image class="img" :src="userInfo.useravatar"></image>
                </view>
                <view class="username">{{userInfo.username}}
                    <view class="userid">UID:{{userInfo.id}}</view>
                </view>
            </div>
        </div>
    </view>
</template>

<script>
    import {
        navigateBack
    } from '@/scripts/compatible/pageOptions.js'
    import {
        height,
        top,
        right,
    } from '@/scripts/compatible/clientRect.js'
    export default {
        props: {
            userInfo: {
                type: Object,
                require: true
            },
        },
        data() {
            return {
                clientRect: {
                    height: 32,
                    top: 24,
                    right: 8,
                },
            }
        },
        mounted() {
            this.clientRect_init()
        },
        methods: {
            clientRect_init() {
                this.clientRect = {
                    height,
                    top,
                    right,
                }
            },
            handleBack() {
                navigateBack()
            },
            handleHome() {
                uni.reLaunch({
                    url: '/pages/index/index'
                })
            },
        },
    }
</script>

<style lang="scss" scoped>
    .giantScreen {
        position: relative;

        .bg {
            position: absolute;
            z-index: -1;
            top: 0;
            width: 150%;
            left: -25%;
            height: 300px;
            border-radius: 0 0 50% 50%;
        }

        .head {
            color: #fff;
            position: relative;

            .title {
                position: absolute;
                left: 0;
                right: 0;
                margin: auto;
                width: max-content;
                height: 32px;
                display: flex;
                align-items: center;
                font-size: 16px;
            }

            .left {
                position: absolute;
                top: 0;
                bottom: 0;
                margin: auto;
                border-radius: 16px;
                background-color: rgba(0, 0, 0, .2);
                display: flex;
                align-items: center;
                justify-content: space-around;
                padding: 6px 0;
                box-sizing: border-box;
                width: max-content;
                height: 32px;

                .center {
                    color: #fff;
                }

                .back,
                .homekaytix {
                    width: 20px;
                    padding: 0 10px;
                }

                .img {
                    display: block;
                    width: 100%;
                }
            }
        }

        .body {
            overflow: hidden;
            padding: 20px 20px 15px;

            .name {
                color: #fff;
                text-align: right;
                margin-bottom: 15px;
            }

            .info {
                height: 26px;
                display: flex;
                align-items: center;
                justify-content: center;
                background-color: rgba(0, 0, 0, .2);
                border-radius: 13px;
                color: #eee;
                padding: 0 10px;
                font-size: 12px;

                .center {
                    margin: 0 5px;
                }

                .tip {
                    display: flex;
                    align-items: center;
                    flex-direction: row-reverse;

                    .font {
                        font-size: 20px;
                        color: #fbc230;
                        margin-left: 5px;
                    }
                }

            }

            .avatar {
                width: 70px;
                height: 70px;
                margin: 0 auto;
                background-color: rgba(0, 0, 0, .2);
                position: relative;
                // box-shadow: #ffffff6e 0 0 0 10rpx;
                border: 5px solid #ffffff6e;
                border-radius: 50%;
                overflow: hidden;

                .img {
                    display: block;
                    width: 100%;
                    height: 100%;
                }
            }

            .username {
                width: max-content;
                margin: 0 auto;
                color: #fff;
                display: flex;
                align-items: center;
                height: 24px;
                margin-top: 15px;

                .userid {
                    height: 24px;
                    display: flex;
                    align-items: center;
                    background-color: #fff;
                    padding: 0 10px;
                    color: #f1275e;
                    border-radius: 12px;
                    font-size: 12px;
                    margin-left: 10px;
                }
            }
        }
    }
</style>